<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/22 0022
 * Time: 20:50
 */
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use App\Models\Post;

class HomeController extends Controller{
    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @name 首页
     * @author wudean
     */
    public function index(){
        $lists=Post::getHomeByNewData();
        foreach ($lists as $list){
            $list->user_name=$list->user_id==0?'ihammer':'';
            $list->type_name=$list->type_id==0?'美文阅读':'';
            $list->created_at=date("d M Y",time($list->created_at));
        }
        return view('web.home.index',compact(['lists']));
    }
}